const express = require('express');
const router = express.Router();
const authController = require('../controllers/authController');
const { authenticate, isAdmin } = require('../middlewares/authMiddleware');

// 用户信息
router.get('/status', authenticate, authController.status);
router.get('/verify', authenticate, authController.verifyToken);

// 密码修改
router.post('/change-password', authenticate, authController.changePassword);

// 管理员用户管理
router.get('/', authenticate, isAdmin, authController.getAllUsers);
router.get('/sales', authenticate, isAdmin, authController.getSalesUsers);
router.post('/', authenticate, isAdmin, authController.register);
router.put('/:id', authenticate, isAdmin, authController.updateUserStatus);

module.exports = router; 